//
//  PCUserFeedBackController.m
//  PhotoCircle
//
//  Created by GL on 15/12/15.
//  Copyright © 2015年 wujungao. All rights reserved.
//

#import "PCUserFeedBackController.h"
#import "PCMeStore.h"
#import "PCUserModel.h"
#import "PCMeStore.h"
#import "GMString.h"
#import "GMTipsHelper.h"

@interface PCUserFeedBackController ()

@property (weak, nonatomic) IBOutlet UITextView *textView;

@end

@implementation PCUserFeedBackController

-(void)configUI
{
    _textView.layer.cornerRadius = 8;
    _textView.layer.masksToBounds = YES;
    //设置边框及边框颜色
    _textView.layer.borderWidth = 0.5;
    _textView.layer.borderColor =[[UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0] CGColor];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self configUI];
    // Do any additional setup after loading the view.
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    MCHiddenBottomView();
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (IBAction)backEvent:(UIButton *)sender {
    [GMTipsHelper showDismiss];
    [self.navigationController popViewControllerAnimated:YES];
}


- (IBAction)postFeeback:(id)sender {
    
    //修改昵称
    if ([NSString isEmptyString:_textView.text]) {
        return;
    }
    
    [GMTipsHelper showLoading];
    PCUserModel *userModel = [[PCUserInfoManager sharedUserInfo] readUserInfo];
    NSDictionary *pDic = @{@"content":_textView.text,@"token":userModel.userToken};
    [[PCMeStore sharedMeStore] requestUserFeedBack:pDic successHandler:^(NSInteger responCode){
        if (responCode == API_RESPONSE_OK) {
            [GMTipsHelper showSuccess:@"提交成功"];
            [self performSelector:@selector(popViewController) withObject:nil afterDelay:0.8];

        }else{
            [GMTipsHelper showFail:@"提交失败"];
        }
    } errorHandler:^{
        [GMTipsHelper showBadNetwork];
    }];
}

-(void)popViewController
{
    [self backEvent:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
